package com.beyondsoft.sabg.edu.config;

import com.aliyun.teaopenapi.models.Config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 阿里云妙笔SDK配置类
 */
@Configuration
@ConfigurationProperties(prefix = "aliyun.aimiaobi")
@Data
public class AiMiaoBiConfig {

    private String endpoint = "aimiaobi.cn-beijing.aliyuncs.com";
    private String workspaceId = "llm-ozpt22n49vm5sabi";
    private String writingScene = "government";
    private String language = "zh";
    private Integer gcNumberSize = 1;
    private String gcNumberSizeTag = "300字左右";

    @Value("${alibaba.cloud.access-key-id}")
    private String accessKeyId;

    @Value("${alibaba.cloud.access-key-secret}")
    private String accessKeySecret;

    /**
     * 创建妙笔客户端
     */
    @Bean
    public com.aliyun.aimiaobi20230801.Client aiMiaoBiClient() throws Exception {
        // 使用配置文件中的凭据
        Config config = new Config()
                .setAccessKeyId(accessKeyId)
                .setAccessKeySecret(accessKeySecret)
                .setEndpoint(endpoint);
        return new com.aliyun.aimiaobi20230801.Client(config);
    }
}